import axios from 'axios/dist/axios'
import { Toast } from 'vant';

const request = axios.create({
    baseURL: "/",
    timeout: 3000
})

//请求拦截器  请求就拦截
request.interceptors.request.use(config=>{
    Toast.loading({
        message: '加载中...',
        forbidClick: true,
      });
      return config
},error=>{//出现异常
    Toast.clear()
    return error
})
//响应拦截器  响应拦截
request.interceptors.response.use(response=>{
    Toast.clear()
    return response
},error=>{//出现异常
    Toast.clear()
    return error
})

export default request;